<!--
 * @FilePath     : /study_code/vue2.x/component-x-template.html
 * @Description  : x-template 定义模板
 * @Date         : 2025-05-02 20:46:44
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-02 20:46:53
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div id="app">
      <p>父组件下</p>
      <child1></child1>
    </div>

    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>

    <!-- 定义在实例外 -->
    <script type="text/x-template" id="child1Tmpl">
      <p>使用子组件数据： {{msg}}</p>
    </script>

    <script>
      Vue.component('child1', {
        template: '#child1Tmpl',
        data: function () {
          return {
            msg: '在子组件中声明的数据xxx',
          }
        },
      })

      var app = new Vue({
        el: '#app',
        data: {
          // message: '在父组件中声明的数据',
        },
      })
    </script>
  </body>
</html>
